package com.frejoys.app.controller;

import com.frejoys.common.aop.Authority;
import com.frejoys.common.aop.Authorization;
import com.frejoys.common.constant.CommonConstant;
import com.frejoys.common.dto.common.PageDto;
import com.frejoys.common.response.Result;
import com.frejoys.common.util.RequestUtil;
import com.frejoys.common.vo.app.AgentStoreListVo;
import com.frejoys.service.UserLevelStoreMoneyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "用户店铺推广收益", description = "用户店铺推广收益")
@RestController
@RequiredArgsConstructor
@RequestMapping(CommonConstant.routePrefixApp)
@Authorization(Authority.Private)
public class UserLevelStoreMoneyController {

    private final UserLevelStoreMoneyService userLevelStoreMoneyService;

    @Operation(summary = "查询店铺给我带来的收益")
    @PostMapping("/userLevelStoreMoney/listInfo")
    public Result<List<AgentStoreListVo>> listInfo(@RequestBody @Validated PageDto dto) {
        return Result.success(userLevelStoreMoneyService.listInfo(dto, RequestUtil.userId()));
    }
}
